package com.buobao.screenlogcat

import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import com.turman.builibrary.tab.top.BTabTopInfo
import com.turman.builibrary.tab.top.BTabTopLayout

class TabTopActivity:ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.act_tab_top)
        val infoList = ArrayList<BTabTopInfo<*>>()
        infoList.add(BTabTopInfo("首页","#333333","#ff0000"))
        infoList.add(BTabTopInfo("综艺","#333333","#ff0000"))
        infoList.add(BTabTopInfo("动漫","#333333","#ff0000"))
        infoList.add(BTabTopInfo("电影","#333333","#ff0000"))
        infoList.add(BTabTopInfo("短视频","#333333","#ff0000"))
        infoList.add(BTabTopInfo("追星","#333333","#ff0000"))
        infoList.add(BTabTopInfo("纪录片","#333333","#ff0000"))
        infoList.add(BTabTopInfo("经典剧场","#333333","#ff0000"))
        infoList.add(BTabTopInfo("两会","#333333","#ff0000"))
        infoList.add(BTabTopInfo("国际新闻","#333333","#ff0000"))
        infoList.add(BTabTopInfo("大咖","#333333","#ff0000"))
        infoList.add(BTabTopInfo("香格里拉","#333333","#ff0000"))
        infoList.add(BTabTopInfo("吹弹可破","#333333","#ff0000"))
        infoList.add(BTabTopInfo("大唐","#333333","#ff0000"))
        infoList.add(BTabTopInfo("提刑官","#333333","#ff0000"))

        val toplayout = findViewById<BTabTopLayout>(R.id.tab_top_layout)
        toplayout.inflateInfo(infoList)
        toplayout.defaultSelected(infoList[0])
        toplayout.addTabSelected { index, preInfo, nextInfo ->
            Toast.makeText(this@TabTopActivity,"click ${nextInfo.name}",Toast.LENGTH_SHORT).show()
        }
    }
}